import request from '@/utils/request'
/*.then(res => {
    // 返回数据
})
    .catch(err => {
        // 异常情况
    })*/

// •	获取消息数据接口

export default {
  //上传图片或文件接口
  upload (data) {
    return request({
      // ContentType: 'application/json',
      url: '/scs/pocMss/upload',
      method: 'post',
      timeout:30000,
      data
    })
  },
  //获取临时消息接口
  queryLastMsgIndex (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/pocMss/queryLastMsgIndex',
      method: 'post',
      data
    })
  },
  //获取历史消息接口
  queryHisMsg (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/pocMss/queryHisMsg',
      method: 'post',
      data
    })
  },
  //处理聊天记录
  queryMsgAfterIndex (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/pocMss/queryMsgAfterIndex',
      method: 'post',
      data
    })
  },
  //查询会话列表数据
  queryConversationRecordList (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationRecord/queryConversationRecordList',
      method: 'post',
      data
    })
  },
  //查询会话成员列表数据
  queryGroupMember (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/group/queryGroupMember',
      method: 'post',
      data
    })
  },
  //删除会话成员列表数据
  deleteGroupMember (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/group/deleteGroupMember',
      method: 'post',
      data
    })
  },
  //添加会话
  /*
  * conversationId: "869"
conversationType: 2
userId: 1014
userType: 0
  * */
  addConversationRecord (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationRecord/addConversationRecord',
      method: 'post',
      data
    })
  },
  //发起群聊，创建会话组
  addConversationMain (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationMain/addConversationMain',
      method: 'post',
      data
    })
  },
  //发起群聊，查询会话成员
  queryConversationMemberListMain (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationMain/queryConversationMemberList',
      method: 'post',
      data
    })
  }, //发起群聊，添加会话成员
  addOtherConversationMemberMain (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationMain/addOtherConversationMember',
      method: 'post',
      data
    })
  }, //发起群聊，删除会话成员
  deleteConversationMemberMain (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationMain/deleteConversationMember',
      method: 'post',
      data
    })
  }, //发起群聊，修改群名称
  updateConversationNameMain (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationMain/updateConversationName',
      method: 'post',
      data
    })
  }, //发起群聊，删除会话
  deleteConversationMain (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationMain/deleteConversation',
      method: 'post',
      data
    })
  },
  //添加会话
  /*
  conversationId: "14549"
conversationType: "1"
userId: 1014
userType: 0
  * */
  deleteConversationRecord (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationRecord/deleteConversationRecord',
      method: 'post',
      data
    })
  },
  //往会话组添加成员
  /*groupId: 882
    subscriberIds: 18319*/
  addGroupMember (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/group/addGroupMember',
      method: 'post',
      data
    })
  },
  //查询会话数据
  /*fleetId: 67
info: "wx"
managePriv: 7
pageIndex: 1
pageSize: 30
type: 5
userId: "wxq1"*/
  queryBook (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/addressBookController/queryBook',
      method: 'post',
      data
    })
  },
  /*    <update id="updateNickname" parameterType="java.util.HashMap">
        update isp_groupmember set `nickName` = #{nickName} where group_id = #{conversationId} AND SUBSCRIBER_ID = #{member_id}
    </update>
    <select id="queryNickname" parameterType="java.util.HashMap" resultType="java.lang.String">
        SELECT nickName from isp_groupmember where group_id = #{conversationId} AND SUBSCRIBER_ID = #{member_id}
    </select>*/
  //查询所在群昵称
  queryNickname (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationMain/queryNickname',
      method: 'post',
      data
    })
  },  //修改我在所在群昵称
  updateNickname (data) {
    return request({
      ContentType: 'application/json',
      url: '/scs/conversationMain/updateNickname',
      method: 'post',
      data
    })
  },
}
